package com.snowsea.controller;

import com.snowsea.enums.OrderEnums;
import com.snowsea.pojo.Order;
import com.snowsea.service.OrderService;
import com.snowsea.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @className: OrderController
 * @auther: Jerry
 * @date: 2021/4/19 17:36
 * @desctiption: TODO
 * @version: 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping("/submit")
    public R submit(@RequestBody Order order) {
        order.setOrderState(OrderEnums.TOPAID.getCode());
        orderService.submit(order);
        return R.ok();
    }

    @RequestMapping("/pay")
    public R pay(@RequestBody Order order){
        orderService.pay(order);
        return R.ok();
    }
}
